﻿@model dynamic

@{
    ViewBag.Title = "Shikiju's Blog";
}

<style>
    
</style>

<script>
    $(function () {
        $(".button").click(function () {
            if ($('#reply' + $(this).attr("id")).hasClass("replyTextField")) {
                
                $('#reply' + $(this).attr("id")).fadeIn('slow', function () {
                    $(this).removeClass();
                });
            }
            else {
               
                $('#reply' + $(this).attr("id")).fadeOut('slow', function () {
                    $(this).addClass("replyTextField");
                });
            }

        });

        $(".replyDeleteButton").click(function () {
            $.post("/Blog/DeleteReply", { "id": $(this).attr("data-id") },
                function (data) {
                    if (data[0].value != -1) {
                        $('#replyDiv' + data[0].Value).fadeOut('slow');
                    }
                });
        });

    });
</script>

<h2>Shikiju's Blog</h2>

@Html.ActionLink("Create New Post", "Create")

@foreach (var post in Model)
{
    <a href="Blog/Details/@post.id">
        <article id="postDiv">
            <h1>Post Number: @post.id</h1>
            @post.Message.Substring(0, post.Message.Length >= 50 ? 50 : post.Message.Length) ...
        </article> <br />
    </a>
}